package com.eedi.org.hospital.dal.mapper;

import com.eedi.framework.common.pojo.PageResult;
import com.eedi.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.eedi.org.hospital.dal.dataobject.OrgHospitalDO;
import com.eedi.org.hospital.controller.vo.hosp.OrgHospitalPageReqVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.eedi.framework.mybatis.core.mapper.BaseMapperX;
/**
 * 医院 Mapper
 *
 * @author 永聚长青源码
 */
@Mapper
public interface OrgHospitalMapper extends BaseMapperX<OrgHospitalDO> {

    default PageResult<OrgHospitalDO> selectPage(@Param("reqVO") OrgHospitalPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrgHospitalDO>()
                .likeIfPresent(OrgHospitalDO::getOrgHospName, reqVO.getOrgHospName())
                .eqIfPresent(OrgHospitalDO::getOrgNationalCode, reqVO.getOrgNationalCode())
                .orderByDesc(OrgHospitalDO::getOrgHospitalId));
    }


    default OrgHospitalDO selectByName(String orgHospName) {
        return selectOne(OrgHospitalDO::getOrgHospName, orgHospName);
    }

}
